﻿namespace Sidvall.Test
{
    public class Car : Sidvall.UI.Entities.BusinessBase, ICar
    {
        private string _CarId;
        public string CarId
        {
            get
            {
                return _CarId;
            }
            set
            {
                _CarId = value;
                OnPropertyChanged(nameof(CarId));
            }
        }
        private string _Name;
        public string Name
        {
            get
            {
                return _Name;
            }
            set
            {
                _Name = value;
                OnPropertyChanged(nameof(Name));
            }
        }
        private PassengerCollection _Passengers;
        public PassengerCollection Passengers
        {
            get
            {
                if (_Passengers == null)
                    this.Passengers = new PassengerCollection();
                return _Passengers;
            }
            private set
            {
                _Passengers = value;
                OnPropertyChanged(nameof(Passengers));
            }
        }
        private Owner _Owner;
        public Owner Owner
        {
            get
            {
                return _Owner;
            }
            set
            {
                _Owner = value;
                OnPropertyChanged(nameof(Owner));
            }
        }
        private System.DateTime _Time;
        public System.DateTime Time
        {
            get
            {
                return _Time;
            }
            set
            {
                _Time = value;
            }
        }

        IOwner ICar.Owner
        {
            get
            {
                return this.Owner;
            }
            set
            {
                this.Owner = (Owner)value;
            }
        }
        System.Collections.Generic.IEnumerable<IPassenger> ICar.Passengers
        {
            get
            {
                return this.Passengers;
            }
        }
        void ICar.SetPassengers(Data.IDataRowProvider<IPassenger> items)
        {
            this.Passengers = (PassengerCollection)items;
        }
    }
}
